package com.zzw.paymentdemo.controller;

import com.zzw.paymentdemo.entity.Product;
import com.zzw.paymentdemo.service.ProductService;
import com.zzw.paymentdemo.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zzw
 * @date 2023/5/11 16:13
 */
@CrossOrigin //支持跨域
@RestController
@RequestMapping("/api/product")
@Api(tags = "商品管理")
public class ProductController {
    @Autowired
    ProductService productService;
    @ApiOperation("商品列表")
    @GetMapping("/list")
    public R list(){
        List<Product> list = productService.list();
        return R.ok().data("productList",list);
    }

}
